CONTENTS | INDEX | PREV | NEXT
 stpcpy

   NAME
    stpcpy  - copy a string returning a pointer to the end of the destination

   SYNOPSIS
    char *ptr = stpcpy(d, s);
    char *d;
    char *s;

   FUNCTION
    Copy the nul terminated string pointed to by s to the buffer d.
    The nul is copied.  A pointer to the nul character at the end
    of the copied string in d is returned.

   NOTE
    stpcpy() is a non-standard function.  While a stpcpy()/stpcpy()
    combination is more efficient than a strcpy()/strcat() combination,
    strcpy() and strcat() are standard functions and thus guarenteed
    to exist in all enviroments.

   EXAMPLE
    #include <stdio.h>
    #include <string.h>
    #include <assert.h>

    main()
    {
        char *buf1 = "hello";
        char *buf2 = "123";
        char dest[32];
        char *ptr;

        ptr = stpcpy(dest, buf1);
        stpcpy(ptr,  buf2);
        puts(dest);                     /* hello123 */
        return(0);
    }

   INPUTS
    char *d;    pointer to beginning of destination buffer
    char *s;    pointer to beginning of source string

   RESULTS
    char *ptr;  pointer to end of data copied to destination buffer

   SEE ALSO
    strcpy